<%--
  Created by IntelliJ IDEA.
  User: kkk
  Date: 2022/11/21
  Time: 9:06
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>用户新增</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/statics/layui/css/layui.css"/>
    <script src="${pageContext.request.contextPath}/statics/layui/layui.js"  charset="utf-8"></script>
</head>
<body>
<div style="color: #ff0000">${errorMsg}</div>
<br>

<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <legend>新增用户</legend>
</fieldset>
<br>
<form class="layui-form" action="add" method="post">
    <div class="layui-form-item">
        <label class="layui-form-label">角色名称</label>
        <div class="layui-input-inline">
            <input type="text" id="roleName" required lay-verify="required" name="roleName" lay-verify="title" autocomplete="off" placeholder="请输入角色名称" class="layui-input">
            <span>${roleNameError}</span>
            <span id="roleNameSpan">${roleNameError}</span>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">角色权限字符串</label>
        <div class="layui-input-inline">
            <input type="text" name="roleKey" required lay-verify="required"  autocomplete="off" placeholder="请输入角色权限字符串" class="layui-input">
            <span>${roleKeyError}</span>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">显示顺序</label>
        <div class="layui-input-inline">
            <input type="text" name="roleSort" required lay-verify="required"  autocomplete="off" placeholder="请输入显示顺序" class="layui-input">
            <span>${roleSortError}</span>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">数据范围</label>
        <div class="layui-input-inline">
            <select name="dataScope" lay-filter="aihao">=
                <option value="1" selected="">全部数据权限</option>
                <option value="2">自定数据权限</option>
                <option value="3">本部门数据权限</option>
                <option value="4">本部门及以下数据权限</option>
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">角色状态</label>
        <div class="layui-input-inline">
            <input type="radio" name="status" value="1" title="停用">
            <input type="radio" name="status" value="0" title="正常" checked>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">备注</label>
        <div class="layui-input-block">
            <input type="text" name="remark" lay-verify="title" autocomplete="off" placeholder="请输入备注" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            <button type="reset" class="layui-btn layui-btn-primary" onclick="history.back()">返回</button>
        </div>
    </div>
</form>
<script>
    layui.use(['form','jquery','laydate'],function (data) {
        var form=layui.form;
        var $=layui.jquery;
        var laydate=layui.laydate;
        //验证账号是否存在
        $('#account').blur(function () {
            $.get("accountExists?account="+this.value,function (data) {
                if (data==="1"){
                    $('#accountSpan').html("账号已存在");
                    $('#account').val("");
                }else {
                    $('#accountSpan').html("");
                }
            })
        })
        //日期
        laydate.render({
            elem: '#date1'
        });
    })

</script>
</body>
</html>
